public class Player {
	
	private int bet;
	private int cash;
	private boolean canChangeCards;
	private boolean canBid;
	Table table;
	Hand myHand;
	
	Player(int initialCash, Table table){
		//this.table = table;
		canBid=true;
		canChangeCards=true;
		myHand = new Hand();
		cash=initialCash;
		this.table=table;
		
	}
	
	public void setHand(Hand hand){
		this.myHand=hand;		
	}
	
	public boolean canBid(){
		return canBid;
	}
	
	public boolean canChangeCards(){
		return canChangeCards;
	}
	
	public void addCard(Card card){
		myHand.add(card);
	}
	
	public void bet(int amount) throws BadugiException{
		if(amount<cash&&amount>0){
			cash=cash-amount;
			bet=bet+amount;
			table.addToPot(amount);
		}
		else throw new BadugiException("Not enough money");
		
	}
	
	public int getCash(){
		return cash;
	}
	
	public int getBet(){
		return bet;
	}
	
	public void removeCard(int index){
		myHand.remove(index);
	}
	
	public Card getCard(int index){
		return myHand.getCard(index);
	}
	
	
	public void allIn(){
		table.addToPot(cash);
		bet = bet+cash;
		cash=0;
		canBid=false;
	}
	
	public void fold(){
		canBid=false;
		canChangeCards=false;
	}
	
	public Hand getHand(){
		return myHand;
	}
	
	public void addCash(int amount){
		cash=cash+amount;
	}
	
	public void resetBet(){
		bet=0;
	}
	
	public void resetStatus(){
		canBid=true;
		canChangeCards=true;
	}
}
